package com.wmm.fast.main.shop2AbstractFactory.simpleFactory2AbstractFactory;

import com.wmm.fast.main.shop2AbstractFactory.UserFactory;

/**
 * @Auther: wangzun
 * @Date: 2018/9/13 15:14
 * @Description: 聚合工厂执行,通过反射+简单工厂模式舍弃了AbstractFactory及其实现类.增加了db可配置变化, 使得Client无需知道User以外的对象.高度解耦以及更轻松的扩展. 增加User以外的对象只需要创建对应的对象流程,不需要增加工厂
 */
public class ConvergeExecutor {
    public static void main(String[] args) throws Exception {
        UserFactory userFactory = DataAccess.createUser();
        userFactory.insert();
        DataAccess.dbName = "Redis";
        userFactory = DataAccess.createUser();
        userFactory.insert();
    }
}
